<?php /*a:1:{s:60:"D:\web\wwwroot\tp5.1\public/../app/admin\view\log\index.html";i:1517447032;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
    <link rel="icon" href="/static/frame/static/image/code.png">
</head>
<body class="body">
<div class="tab-top">


<div class="search">
  <form class="layui-form" action="">
        <div class="layui-input-inline">
        <select name="search" lay-verify="required" class="search-name" lay-search="">
          <option value="user" <?php echo $search=='user' ? 'selected=""'  :  ''; ?>>用户名</option>
          <option value="ip" <?php echo $search=='ip' ? 'selected=""'  :  ''; ?>>IP</option>
        </select>
      </div>
  <div class="layui-inline">
    <input class="layui-input layui-input-sm" name="val" placeholder="请输入用户名" id="search-elm" autocomplete="off" value="<?php echo htmlentities($val); ?>">
  </div>
  <button class="layui-btn site-demo-active layui-btn-sm search-btn" data-type="reload">搜索</button>
</form>
</div>
</div>

<div class="layui-clear system-table-1" style="padding-top:10px;">

<table class="layui-table" lay-filter="parse-table-demo" lay-data="{height:'full-120',url:'<?php echo url('admin/log/ajaxlist',Request::param()); ?>', page:true, id:'test',limit:'<?php echo config('webconfig.page'); ?>'}">
  <thead>
    <tr>
     <th lay-data="{type:'checkbox', fixed: 'left'}"></th>
      <th lay-data="{field:'id', width:50, sort: true}">ID</th>
      <th lay-data="{field:'user', width:100}">用户</th>
      <th lay-data="{field:'title',align:'right', width:120}">操作</th>
      <th lay-data="{field:'ip', width:150}">ip</th>
      <th lay-data="{field:'create_time', width:180}">时间</th>
      <th lay-data="{field:'text', minwidth:60}">备注</th>
    </tr> 
  </thead>
</table>

</div>
<button class="layui-btn getCheckData layui-btn-sm">全部删去</button>  <button class="layui-btn btn-xls layui-btn-sm" id="btn-xls">导出数据</button>
<!-- 通用-970*90 -->
<script src="/static/frame/layui/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/comm.js" charset="utf-8"></script>
<script type="text/javascript">
layui.use(['form', 'table','layer'], function() {
    var $ = layui.jquery,
        form = layui.form,
        table = layui.table,
        layer = layui.layer;
    // you code ...
  $('.getCheckData').on('click', function(){
  	var list = '';
      var checkStatus = table.checkStatus('test')
      ,data = checkStatus.data;
      console.log(data.length);
      for (var i = data.length - 1; i >= 0; i--) {
      	list += data[i].id + ',';
      }
      // 去除最后一位逗号
      list = list.substr(0, (list.length - 1));
	  $.post("<?php echo url('admin/Log/deleteAll'); ?>", {'ids': list}, function(data) {
			if (data.code ==1) {
				layer.msg(data.msg, {time: 1000}, function() {
                      //执行重载
                    table.reload('test', {page: {curr: 1 }});
                });
			}

      if (data.code === 0) {
        layer.msg(data.msg);
      }
	   });
  });

$('#btn-xls').click(function(){
      layer.open({
        title: "数据导出",
        type: 2,
        area: ['550px', '500px'],
        fixed: false, //不固定
        maxmin: true,
        content: "<?php echo url('admin/Log/xls'); ?>"
      });

});


});
</script>
</body>
</html>